<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>自定义登录界面</title>

<!--    引入element-ui样式-->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div style="width: auto;height: 100vh;background-color: darkcyan;overflow: hidden">
    <div id="app" style="width: 400px;margin: 150px auto">
        <div style="color:white;font-size: 30px;text-align: center;padding: 35px 0">欢迎登陆</div>
        <el-input prefix-icon="el-icon-s-custom" v-model="username" placeholder="请输入用户名"></el-input>
        <el-input prefix-icon="el-icon-key" v-model="password" placeholder="请输入密码" show-password></el-input>
        <el-button style="width: 100%" type="success" @click="login()">提交</el-button>
    </div>
</div>

<!--引入组件库-->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!--<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>-->
<!--<script src="js/vue_2.js"></script>-->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<!--<script src="js/index.js"></script>-->
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<!--<script src="js/axios.min.js"></script>-->

<script>
    new Vue({
        el:"#app",
        data:{
            username:"",
            password:""
        },
        methods:{
            login(){
                axios.post("/login?username="+this.username+"&password="+this.password).then((res)=>{
                    if (res.data == "success"){
                        this.$message.success("登录成功")
                    }else {
                        this.$message.error("用户名或密码错误");
                    }
                })
            }
        }
    })
</script>

</body>
</html>

